<include file="Common/works/header" /><include file="Common/works/left_menu" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/waitMe.css" />
<!-- <form action="/apiworks/apiAdd.html" class="right" id="tab1" method="post"> -->

<div action="/apiworks/apiAdd.html" class="right" id="tab1" method="post">
  <div class="faservice_title"><a href="/apiworks/apiList" title="我的API">我的API</a>&nbsp;&gt;&nbsp;{$info.service_name}&nbsp;&gt;&nbsp;编辑API</div>
  <div class="faservice">
    <div class="column">
      <div class="fielbt"><span class="fielbtbt">编辑API</span	><span>{$info.create_time|date='Y-m-d H:i:s',###}</span></div>
    </div>
    <div class="column">
      <div class="fieldt">所属服务:<span>{$info.service_name}</span></div>
    </div>
    <div class="column">
      <div class="field">API名称:</div>
      <input name="api_name" id="api_name" opt-tip="请输入API名称" class="kt1 fl _api_name _blur_rz" value="{$info.api_name}" maxlength="20" placeholder="请填写中文名称，不超过10个字" />
			<div id="api_name_id" class="error hide">
				<i></i><span id="api_name_msg"></span>
			</div>
    </div>
    <div class="column">
      <div class="field">英文名称:</div>
      <input name="api_name_en" disabled="disabled" id="api_name_en" opt-tip="请输入API英文名称" class="kt1 fl _api_name_en _blur_rz" value="{$info.api_name_en}" autocomplete="on"  maxlength="40"  placeholder="请填写您API地址中的api_name" />
 			<div id="api_name_en_id" class="error hide">
				<i></i><span id="api_name_en_msg"></span>
			</div>
      <div class="cls"></div>
    </div>
    <div class="column">
      <div class="fieldd">英文名称用于生成云途数据的API地址： https://api.37degree.com/open/{$info.service_name_en}/<span style=" color:#1080f2">api_name</span> 保存后不能修改</div>
    </div>
    <div class="cls"></div>
    <div class="column">
      <div class="field">API介绍:</div>
      <textarea name="api_introduction" opt-tip="请输入API介绍" id="api_introduction" class="textarea fl _api_introduction _blur_rz" placeholder="请填写API介绍" />{$info.api_introduction}</textarea>
			<div id="api_introduction_id" class="error hide" style="margin-top: 36px">
				<i></i><span id="api_introduction_msg"></span>
			</div>
    </div>
    <div class="column">
      <div class="fieldt fl">请求方式:</div>
      <div class="classification"> <input name="api_request_method" class="xz api_request_method" type="radio" value="0"
        <if condition="$info.api_request_method eq 0">checked="checked"</if>
        />
        GET/POST</div>
      <div class="classification"> <input name="api_request_method"
        <if condition="$info.api_request_method eq 1">checked="checked"</if>
        class="xz api_request_method" type="radio" value="1"/>
        POST</div>
      <div class="classification"> <input name="api_request_method"
        <if condition="$info.api_request_method eq 2">checked="checked"</if>
        class="xz api_request_method" type="radio" value="2"/>
        GET</div>
      <div class="cls"></div>
    </div>
    <div class="column">
      <div class="fieldt fl">返回格式:</div>
      <div class="classification"> <input name="api_result_format"
        <if condition="strtolower($info['api_result_format']) eq 'json'">checked="checked"</if>
        class="xz _api_result_format" type="radio" value="JSON" checked="checked"/>
        JSON</div>
     <!-- <div class="classification"> <input name="api_result_format"
        <if condition="strtolower($info['api_result_format']) eq 'xml'">checked="checked"</if>
        class="xz _api_result_format" type="radio" value="xml"/>
        XML</div>-->
      <div class="cls"></div>
    </div>
    <div class="column">
      <div class="fieldt">授权方式: <span>HTTP Basic Authentication</span>
        <input type="hidden" value="HTTP Basic Authentication" class="_api_authorized_type" />
      </div>
    </div>
    <div class="column">
      <div class="fieldt fl">API地址 ： </div>
      <!-- <div class="slurl">106.4.46.151:80</div> -->
      <div class="slurl">http://{$info.service_host}/
        <span><input name="api_uri" id="api_uri" <if condition="$in_white_list neq 1">disabled="disabled"</if> class="kt7 _api_uri" autocomplete="on"  maxlength="50" value="{$info.api_uri}"/></span>
      </div>
      <div class="commentaryt">&nbsp;&nbsp;API完整的请求地址(不带参数)</div>
      <div class="cls"></div>
    </div>
    <div class="column" style="width:100%"> </div>
    <div class="column">
      <div class="fieldt">请求参数:</div>
    </div>
    <div class="column">
      <div class="table-top">
        <div class="tab" style=" width:12%">参数名</div>
        <div class="tab" style=" width:12%">类型</div>
        <div class="tab" style=" width:12%">是否必填</div>
        <div class="tab" style=" width:31%">示例默认值</div>
        <div class="tab" style=" width:31%">说明</div>
      </div>
      <!-- 循环 -->
      <div jput="users" jput-jsondata='[]'>
      <div class="_raw_request_param">
          <div class="table-foot fl _ul_li">
            <div class="tab" style=" width:12%">
              <input name="api_request_param" id="" value="{{json.req_name}}"  onblur="javascript:checkValue(this,'._api_request_param_input');return false;" onfocus="javascript:rmError(this);return false;" class="kt5 _api_request_param_input" autocomplete="on"  maxlength="50" style="width:90%"/>
            </div>
            <div class="tab" style=" width:12%">
              <div class="select"><div>
              <select class="kt5 _api_request_param" id="api_request_param_type" onchange="javascript:selectChange(this,'api_request_param',$(this).val());return false;">
					<option value="string"  {{json.req_type1}}>string</option>
					<option value="number"  {{json.req_type2}}>number</option>
                    <option value="boolean" {{json.req_type3}}>boolean</option>
              </select>
              <input type="hidden" name="api_request_param" value="{{json.req_type}}" class="_api_request_param_type"/>
              </div></div>
              <!--选中项值-->
            </div>
            <div class="tab" style=" width:12%">
              <div class="select"><div>
              <select class="kt5" id="api_request_param_master" onchange="javascript:selectChange(this,'api_request_param',$(this).val());return false;">
                <option value="1" {{json.req_master1}}>是</option>
                <option value="0" {{json.req_master2}}>否</option>
              </select>
              <input type="hidden" name="api_request_param" value="{{json.req_master}}" class="_api_request_param_master"/>
              </div></div>
              <!--选中项值-->
            </div>
            <div class="tab" style=" width:31%">
              <input name="api_request_param" id="" value="{{json.req_default_value}}" class="kt5" autocomplete="on"/>
            </div>
            <div class="tab" style=" width:31%">
              <input name="api_request_param" id="" value="{{json.req_desc}}" class="kt5" autocomplete="on"/>
            </div>
          </div>
        <div class="commentaryy"><a href="javascript:void(0)" class="_request_param_del">删除</a></div>
        </div>
      </div>
      <!-- 循环 -->
    </div>
    <div class="cls"></div>
    <div class="column" style="height:50px; margin-top:16px"><a href="javascript:void(0)" id="save" class="cobed" title="继续添加">继续添加</a></div>
    <div class="column">
      <div class="fieldt">返回字段:</div>
    </div>
    <div class="column">
      <div class="table-top">
        <div class="tab" style="width:33%">字段名</div>
        <div class="tab" style="width:33%">类型</div>
        <div class="tab" style="width:33%">说明</div>
      </div>

      <!-- 循环 -->
      <div jput="users1" jput-jsondata='[]'>
      <div class="_raw_return_param">
          <div class="table-foot fl">
            <div class="tab" style="width:33%">
              <input name="api_result_field" onblur="javascript:checkValue(this,'._api_result_field');return false;" onfocus="javascript:rmError(this);return false;" value="{{json.ret_name}}" class="kt5 _api_result_field" autocomplete="on"  maxlength="50" />
            </div>
            <div class="tab" style="width:33%">
              <div class="select" style="width:97%"><div style="width:100%">
              <select class="kt5" onchange="javascript:selectChange(this,'api_result_field',$(this).val());return false;" style="width:100%">
					<option value="string"  {{json.ret_type1}}>string</option>
					<option value="number"  {{json.ret_type2}}>number</option>
                    <option value="boolean" {{json.ret_type3}}>boolean</option>
              </select>
              <input type="hidden" name="api_result_field" value="{{json.ret_type}}" class="_api_return_result_type"/>
              </div></div>
              <!--选中项值-->
            </div>
            <div class="tab" style="width:33%">
              <input name="api_result_field" id="" value="{{json.ret_desc}}" class="kt5" autocomplete="on"/>
            </div>
          </div>
        <div class="commentaryy"><a href="javascript:void(0)" class="_return_param_del">删除</a></div>
        </div>
      </div>
      <!-- 循环 -->

    </div>
    <div class="cls"></div>
    <div class="column" style="height:50px; margin-top:16px"><a href="javascript:void(0)" id="save1" class="cobed" title="继续添加">继续添加</a></div>



    <div class="column">
			<div class="fieldt">返回示例(JSON/XML):</div>
	</div>
	<div class="column" style="width: 100%">
			<textarea name="api_result_sample" id="column"
				class="textarea1 _api_result_sample" autocomplete="on">{$info.api_result_sample}</textarea>
	</div>



    <div class="column">
      <div class="fieldt">错误码:</div>
    </div>
    <div class="column">
      <div class="table-top">
        <div class="tab" style="width:33%">错误码</div>
        <div class="tab" style="width:33%">错误信息</div>
        <div class="tab" style="width:33%">错误码返回说明</div>
      </div>

      <!-- 循环 -->
      <div jput="users2" jput-jsondata='[]'>
      <div class="_raw_error_param">
          <div class="table-foot fl">
            <div class="tab" style="width:33%">
              <input name="api_error_codes" id="name" value="{{json.error_code}}" onblur="javascript:checkErrorCodeValue(this,'._api_error_codes');return false;" onfocus="javascript:rmError(this);return false;" class="kt5 _api_error_codes" autocomplete="on"  maxlength="50" />
            </div>
            <div class="tab" style="width:33%">
              <input name="api_error_codes" id="" value="{{json.error_info}}" class="kt5" autocomplete="on"/>
            </div>
            <div class="tab" style="width:33%">
              <input name="api_error_codes" id="" value="{{json.error_desc}}" class="kt5" autocomplete="on"/>
            </div>
          </div>
          <div class="commentaryy"><a href="javascript:void(0)" class="_error_param_del">删除</a> </div>
        </div>
      </div>
      <!-- 循环 -->
    </div>
    <div class="cls"></div>
    <div class="column" style="height:50px; margin-top:16px"><a href="javascript:void(0)" id="save2" class="cobed" title="继续添加">继续添加</a></div>
    <div class="column">
      <div class="fieldt fl">数据更新类型:</div>
      <div class="classification"> <input name="api_update_type" id="service_name" class="xz" type="radio" value="1"
        <if condition="$info.api_update_type eq 1">checked="checked"</if>
        />
        实时更新</div>
      <div class="classification"> <input name="api_update_type" id="service_name" class="xz" type="radio" value="2"
        <if condition="$info.api_update_type eq 2">checked="checked"</if>
        />
        静态数据</div>
      <div class="cls"></div>
    </div>
    <div class="column _chargeType">
      <div class="fieldt fl">收费类型:</div>
      <div class="classification"> <input name="api_is_charge" class="xz" type="radio" value="0"
        <if condition="$info.api_is_charge eq 0">checked="checked"</if>
        />
        免费</div>
      <div class="classification"> <input name="api_is_charge" class="xz" type="radio" value="1"
        <if condition="$info.api_is_charge eq 1">checked="checked"</if>
        />
        收费（设置资费规则，请联系support@37degree.com）</div>
      <div class="cls"></div>

	<if condition="$info['api_is_charge'] eq 1">
      <div class="column _mainJudge">
        <div class="table-top">
          <div class="tab" style="width:20%">套餐周期</div>
          <div class="tab" style="width:20%">价格</div>
          <div class="tab" style="width:20%">调用次数</div>
          <div class="tab" style="width:20%">每次返回</div>
          <div class="tab" style="width:19%">并发次数</div>
        </div>

        <foreach name="info['api_charge_rules']" item="rules" key="ruleskey" >
          <div class="_raw_error_param _addJudge">
        <div class="table-foot fl">
          <div class="tab" style="width:20%">
            <select class="kt5 _api_request_param" id="api_request_param_type">
              <option value="1个月" <if condition="$rules['package_date'] eq 31">selected="selected"</if>>1个月</option>
              <option value="3个月" <if condition="$rules['package_date'] eq 92">selected="selected"</if> >3个月</option>
              <option value="半年" <if condition="$rules['package_date'] eq 183">selected="selected"</if>>半年</option>
              <option value="一年" <if condition="$rules['package_date'] eq 365">selected="selected"</if>>一年</option>
            </select>
            <input type="hidden" name="api_date" value="{$rules['package_cycle']}"/>
          </div>

          <div class="tab" style="width:20%">
            <input name="" mandatory="on" value="{$rules.package_price}" class="kt5" autocomplete="off"  maxlength="50" style="width:80%" />
            <span class="package-danwei">元</span>
          </div>

          <div class="tab" style="width:20%">
            <input name=""  mandatory="on" value="{$rules.limit_num}" class="kt5" autocomplete="off"  maxlength="50" style="width:80%" />
            <span class="package-danwei">次</span>
          </div>

          <div class="tab" style="width:20%">
            <input name="return_num"  value="{$rules.return_num}" class="kt5" autocomplete="off"  maxlength="50" style="width:80%" />
            <span class="package-danwei">条</span>
          </div>

          <div class="tab" style="width:19%">
            <input name="con_num"  value="{$rules.con_num}" class="kt5" autocomplete="off"  maxlength="50" style="width:70%" />
            <span class="package-danwei"  style="width:20%">次/秒</span>
          </div>

          <input name="package_name" value="{$rules.package_name}" type="hidden" />
          <input name="package_date" value="{$rules.package_date}" type="hidden" />
        </div>
  <div class="commentaryy "></div>
</div>
      </foreach>

      </div>
      <div class="cls"></div>
      <div class="column _mainJudge_2" style="height:50px; margin-top:16px;"><a href="javascript:void(0)" class="cobed _setMeal" title="继续添加">继续添加</a></div>
	</if>

    </div>


  <!-- todo-->
    <div class="column _mainJudge" style="display: none;">
      <div class="table-top">
        <div class="tab" style="width:20%">套餐周期</div>
        <div class="tab" style="width:20%">价格</div>
        <div class="tab" style="width:20%">调用次数</div>
        <div class="tab" style="width:20%">每次返回</div>
        <div class="tab" style="width:19%">并发次数</div>
      </div>

      <div class="_raw_error_param _addJudge">
        <div class="table-foot fl">
          <div class="tab" style="width:20%"><select class="kt5 _api_request_param"
                                                     id="api_request_param_type">
            <option value="1个月">1个月</option>
            <option value="3个月">3个月</option>
            <option value="半年">半年</option>
            <option value="一年">一年</option>
          </select><input type="hidden" name="api_date" value="1个月" class="_api_request_param_type"></div>
          <div class="tab" style="width:20%"><input name="" mandatory="on" value="" class="kt5"
                                                    autocomplete="off" maxlength="50" style="width:80%"><span
                  class="package-danwei">元</span></div>
          <div class="tab" style="width:20%"><input name="" mandatory="on" value="" class="kt5"
                                                    autocomplete="off" maxlength="50" style="width:80%"><span
                  class="package-danwei">次</span></div>
          <div class="tab" style="width:20%"><input name="" value="" class="kt5" autocomplete="off"
                                                    maxlength="50" style="width:80%"><span
                  class="package-danwei">条</span></div>
          <div class="tab" style="width:19%"><input name="" value="" class="kt5" autocomplete="off"
                                                    maxlength="50" style="width:70%"><span
                  class="package-danwei" style="width:22%">次/秒</span></div>
        </div>
        <div class="commentaryy"></div>
      </div>

    </div>
    <div class="cls"></div>
    <div class="column _mainJudge_2" style="height:50px; margin-top:16px; display:none"><a href="javascript:void(0)" class="cobed _setMeal" title="继续添加">继续添加</a></div>
    <!-- todo-->


    <div class="commentaryt">如果您已在其他平台发布该API，请填写其他平台的链接，帮助您更快通过审核，如果没有请勿填写。</div>
    <div class="column" style="width:100%">
      <input name="api_other_platform_sample" id="api_other_platform_sample" class="kt6 _api_other_platform_sample" autocomplete="on"  maxlength="50" value="{$info.api_other_platform_sample}"/>
    </div>

    <div class="column" style="margin-top:20px">
			<button type="button" class="confirm _api_save" id="register">保存</button>
            <button type="button" data-authstatus="1" class="confirm _api_add_submit" style="margin-left:14px" id="register_api">提交审核</button>
      <div class="cls"></div>
    </div>
  </div>
  <!-- </form> -->
</div>
<input type="hidden" value="{$info.service_id}" class="_service_id" />
<input type="hidden" value="{$info.service_name_en}" class="_service_name_en" />
<input type="hidden" value="{$info.service_name}" class="_service_name" />
<input type="hidden" value="{$info.api_id}" class="_api_id" />
<input type="hidden" value='<?php echo ($info["api_request_param"]);?>' class="_hidden_api_request_param" />
<input type="hidden" value='<?php echo ($info["api_result_field"]);?>' class="_hidden_api_result_field" />
<input type="hidden" value='<?php echo ($info["api_error_codes"]);?>' class="_hidden_api_error_codes" />
</div>
</body><script src="__PUBLIC__/home/js/jput-2.js"></script>
<script src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript" src="__PUBLIC__/home/js/serviceapi_common.js"></script>
<script type="text/javascript" src="__PUBLIC__/home/js/apiedit.js"></script>
<script src="__PUBLIC__/home/js/waitMe.js"></script>
<script src="__PUBLIC__/home/js/apiupdate.js"></script>
<script src="__PUBLIC__/home/js/apiadd-add.js" type="text/javascript" charset="utf-8"></script>
</html>


